import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import i18n from './locales'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import en from 'element-plus/dist/locale/en.mjs'

// 引入其他样式
import './styles/index.scss'

// 引入 Tailwind CSS
import './styles/tailwind.css'

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(createPinia()) // 启用 Pinia
app.use(router) // 启用 Router
app.use(ElementPlus, {
  locale: i18n.global.locale.value === 'zh-cn' ? zhCn : en
}) // 启用 Element Plus
app.use(i18n) // 启用国际化

app.mount('#app')
